import {postJson, get} from "./request";

export const userHttp = {

  // 用户详情
  get: function (userId) {
    let  params =  {
      url: '/user',
      data: {
        'userId': userId,
      }
    }
    return get(params)
  },

  // 根据用户id，获取用户
  getMenuList: function () {
    let  params =  {
      url: '/user/menu',
    }
    return get(params)
  },


  list: function (user) {
    let  params = {
      url: '/user/list',
      data: user
    }
    return get(params)
  },

  listPage: function (pageNum,pageSize) {
    let  params =  {
      url: '/user/list',
      data: {
        'pageNum': pageNum,
        'pageSize': pageSize
      }
    }
    return get(params)
  },

  /*
  用户添加
 */
  add: function (user) {
    let  params =  {
      url: '/user/add',
      data: {
        'sex': user.sex,
        'accountId': user.accountId,
        'passWord': user.passWord,
        'email': user.email,
        'nickName': user.nickName,
        'remark': user.remark,
        'roleIdList': user.roleIdList,
      }
    }
    return postJson(params)
  },


  /*
    用户删除
   */
  del: function (userId) {
    let  params =  {
      url: '/user/del',
      data: {
        'userId': userId,
      }
    }
    return postJson(params)
  },


  /*
    用户修改
   */
  edit: function (user) {
    let  params =  {
      url: '/user/edit',
      data: {
        'userId': user.userId,
        'accountId': user.accountId,
        'email': user.email,
        'nickName': user.nickName,
        'remark': user.remark,
        'status': user.status,
        'roleIdList': user.roleIdList,
      }
    }
    return postJson(params)
  },

  login: function (user) {
    let  params =  {
      url: '/user/login',
      data: {
        'accountId': user.accountId,
        'passWord': user.passWord,
      }
    }
    return postJson(params)
  },

}



